//
//  FriendRespondDateBase.h
//  SIPphone
//
//  Created by wrt on 13-11-28.
//  Copyright (c) 2013年 wrtsoft. All rights reserved.
//  好友请求数据库单例

#import <Foundation/Foundation.h>
#import <sqlite3.h>

//请求消息的宏定义

#define FRIENDRPDTABLE_NAME @"friendRespondTable"
#define FRIENDRPD_USERNAME @"friendRespondUsername"
#define FRIENDRPD_DISPLAYNAME @"friendRespondDisplayName"
#define FRIENDRPD_IPPORT @"friendRespondIPPort"
#define FRIENDRPD_ISREAD @"friendRespondISread"
#define FRIENDRPD_TIME @"friendRespondTime"
#define FRIENDRPD_ISRQTORJT @"friendRespondIsRqtOrRjt"
#define FRIENDRPD_ISDO @"friendRespondIsDo"

@interface FriendRespondDateBase : NSObject
{
    sqlite3 *db;
}
//===============全部读取==================
//用户名数组
@property (strong, nonatomic) NSMutableArray *userNameArray;
//昵称数组
@property (strong, nonatomic) NSMutableArray *displayNameArray;
//域名的数组
@property (strong, nonatomic) NSMutableArray *ipPortArray;
//是否已读的数组
@property (strong, nonatomic) NSMutableArray *isReadArray;
//接收到的时间数组
@property (strong, nonatomic) NSMutableArray *timeArray;
//是请求还是拒绝的信息数组
@property (strong, nonatomic) NSMutableArray *isRqtOrRjtArray;
//是否进行的了处理
@property (strong, nonatomic) NSMutableArray *isDoArray;


//===============部分读取==================
//用户名数组
@property (strong, nonatomic) NSMutableArray *partUserNameArray;
//昵称数组
@property (strong, nonatomic) NSMutableArray *partDisplayNameArray;
//域名的数组
@property (strong, nonatomic) NSMutableArray *partIpPortArray;
//是否已读的数组
@property (strong, nonatomic) NSMutableArray *partIsReadArray;
//接收到的时间数组
@property (strong, nonatomic) NSMutableArray *partTimeArray;
//是请求还是拒绝的信息数组
@property (strong, nonatomic) NSMutableArray *partIsRqtOrRjtArray;
//是否进行的了处理
@property (strong, nonatomic) NSMutableArray *partIsDoArray;





//定义表名的属性
@property (strong, nonatomic) NSString *tableNameForUser;

//单例初始化方法
+ (FriendRespondDateBase *)shareFriendRespondDateBase;

//创建数据库
- (void)creatDB;
//读取数据库
- (void)readDB;
//保存数据库
- (void)saveFriendRequstDBWithUserName:(NSString *)userName andDisPlayName:(NSString *)disPlayname andIPport:(NSString *)ip andTime:(NSString *)time andType:(NSString *)type;
//数据库删除
- (void)deleteFriendBDWithUserName:(NSString *)userName andTime:(NSString *)time;
//数据库全部删除
- (void)removeAllFriendRespond;
//数据库更新(判断是否已读)
- (void)updateDBForReadWithUserName:(NSString *)userName andTime:(NSString *)time;
//数据库更新(判断是否进行了操作)
- (void)updateDBForIsDoWithUserName:(NSString *)userName andIP:(NSString *)ip;
//数据库更新(更新用户昵称)
- (void)updateDBForDisplayNameWithUserName:(NSString *)userName andIP:(NSString *)ip andDisplayName:(NSString *)displayname;
//获取未读的条数
- (int)countForUnreadWith;
//获取部分信息15一组
- (void)readDBForpartWithBeginNumber:(int)begin;

//切换表名
- (void)changeTableName:(NSString *)userName;
@end
